package ads.pin.pinmon.scenes;

import java.sql.SQLException;

import ads.pin.pinmon.dal.PlayerDAO;
import ads.pin.pinmon.entity.Player;

import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;

public class GameOverScene extends Scene {

	private Player m_player;

	public GameOverScene(Game game, Player player) {
		this.m_game = game;
		this.m_spriteBatch = new SpriteBatch();
		this.m_player = player;

		updatePlayerDAO();

	}

	private void updatePlayerDAO() {
		PlayerDAO playerDAO = new PlayerDAO();

		try {
			playerDAO.update(m_player);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	@Override
	public void update(float deltaTime) {
		if (Gdx.input.isKeyPressed(Input.Keys.ENTER)) {

			m_game.setScreen(new PinmonScene(m_game, m_player));

		} else if (Gdx.input.isKeyPressed(Input.Keys.ESCAPE)) {
			m_game.setScreen(new StartScene(m_game));
		}

	}

	@Override
	public void draw(float deltaTime) {
		// TODO Auto-generated method stub

	}
}
